<template>
  {{ showValue }}
</template>

<script setup>
import {DefaultFieldDefinition} from '@/components/form/DefaultFormDefinition';
import {computed} from 'vue';
import {isEmpty} from '@/utils/CommonUtils';

const props = defineProps({
  field: {
    type: Object,
    default: DefaultFieldDefinition
  },
  data: {
    type: Object,
    default: () => ({})
  }
});

const showValue = computed(() => {
  if (isEmpty(props.field) || isEmpty(props.field.tableFieldName) || isEmpty(props.data)) {
    return null;
  }
  let fieldName = props.field.tableFieldName;
  return props.data[fieldName];
});
</script>
